<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/extras/spring-security" lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>考试座位管理系统 - 控制面板</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css">
    <style>
        body {
            font-family: 'Microsoft YaHei', Arial, sans-serif;
            background-color: #f0f4f8;
            margin: 0;
            padding: 0;
            color: #333;
        }
        .dashboard-container {
            max-width: 1400px;
            margin: 20px auto;
            padding: 0 15px;
        }
        .card {
            border-radius: 15px;
            box-shadow: 0 6px 30px rgba(0, 0, 0, 0.1);
            margin-bottom: 25px;
            transition: transform 0.3s ease;
        }
        .card:hover {
            transform: translateY(-5px);
        }
        .card-header {
            border-radius: 15px 15px 0 0 !important;
            font-weight: bold;
        }
        .btn-dashboard {
            padding: 12px 25px;
            font-size: 18px;
            border-radius: 10px;
            margin: 10px;
            transition: all 0.3s ease;
        }
        .btn-dashboard:hover {
            transform: scale(1.05);
        }
        .navbar {
            background-color: #0d6efd;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        }
        .navbar-brand {
            font-weight: bold;
            font-size: 1.5rem;
        }
        .welcome-message {
            font-size: 1.2rem;
            margin-bottom: 20px;
        }
    </style>
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg navbar-dark">
        <div class="container-fluid">
            <a class="navbar-brand" href="/dashboard">考试座位管理系统</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav me-auto">
                    <li class="nav-item">
                        <a class="nav-link active" href="/dashboard">首页</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/admin">座位编排</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/exam">考试信息</a>
                    </li>
                    <li class="nav-item" sec:authorize="hasRole('ADMIN')">
                        <a class="nav-link" href="/users/list">用户管理</a>
                    </li>
                </ul>
                <ul class="navbar-nav">
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown">
                            <i class="bi bi-person-circle"></i> <span sec:authentication="name">用户名</span>
                        </a>
                        <ul class="dropdown-menu dropdown-menu-end">
                            <li><a class="dropdown-item" href="/users/profile"><i class="bi bi-person"></i> 个人资料</a></li>
                            <li><a class="dropdown-item" href="/users/change-password"><i class="bi bi-key"></i> 修改密码</a></li>
                            <li><hr class="dropdown-divider"></li>
                            <li><a class="dropdown-item" href="/auth/logout"><i class="bi bi-box-arrow-right"></i> 退出登录</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <!-- 主要内容 -->
    <div class="dashboard-container">
        <div class="row mt-4">
            <div class="col-12">
                <div class="welcome-message">
                    <h2>欢迎使用考试座位管理系统，<span sec:authentication="name">用户</span>！</h2>
                    <p class="text-muted">今天是 <span th:text="${#temporals.format(#temporals.createNow(), 'yyyy年MM月dd日 EEEE')}">2023年1月1日 星期一</span></p>
                </div>
            </div>
        </div>

        <div class="row">
            <!-- 考试管理卡片 -->
            <div class="col-md-6 col-lg-4 mb-4">
                <div class="card h-100">
                    <div class="card-header bg-primary text-white">
                        <h3 class="mb-0">考试座位管理</h3>
                    </div>
                    <div class="card-body text-center">
                        <p class="card-text">编排考试座位，管理考场信息</p>
                        <a href="/admin" class="btn btn-primary btn-dashboard"><i class="bi bi-grid-3x3"></i> 编排座位</a>
                    </div>
                </div>
            </div>

            <!-- 考试信息卡片 -->
            <div class="col-md-6 col-lg-4 mb-4">
                <div class="card h-100">
                    <div class="card-header bg-success text-white">
                        <h3 class="mb-0">考试信息查询</h3>
                    </div>
                    <div class="card-body text-center">
                        <p class="card-text">查看考试信息，打印座位表</p>
                        <a href="/exam" class="btn btn-success btn-dashboard"><i class="bi bi-search"></i> 查看考试信息</a>
                    </div>
                </div>
            </div>

            <!-- 用户管理卡片 (仅管理员可见) -->
            <div class="col-md-6 col-lg-4 mb-4" sec:authorize="hasRole('ADMIN')">
                <div class="card h-100">
                    <div class="card-header bg-danger text-white">
                        <h3 class="mb-0">用户管理</h3>
                    </div>
                    <div class="card-body text-center">
                        <p class="card-text">管理系统用户，设置权限</p>
                        <a href="/users/list" class="btn btn-danger btn-dashboard"><i class="bi bi-people"></i> 用户管理</a>
                    </div>
                </div>
            </div>

            <!-- 个人资料卡片 -->
            <div class="col-md-6 col-lg-4 mb-4">
                <div class="card h-100">
                    <div class="card-header bg-info text-white">
                        <h3 class="mb-0">个人资料</h3>
                    </div>
                    <div class="card-body text-center">
                        <p class="card-text">查看和修改个人资料信息</p>
                        <a href="/users/profile" class="btn btn-info btn-dashboard"><i class="bi bi-person"></i> 个人资料</a>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>